import Vue from "vue";
import {actions} from '../base';

let url = 'admin/api/app-appid';

export default {
    namespaced: true,
    state: {
        all: [],
        configs: {

        },
        options: {
            channels: {
                kuaishou: {label: '推广-快手', value: "kuaishou"},
                douyin: {label: '推广-抖音', value: "douyin"},
                baidu: {label: '推广-百度', value: "baidu"},
                tencent: {label: '推广-腾讯', value: "tencent"},
                alipay: {label: '绑定-支付宝', value: "alipay"},
                shanyan: {label: '登录-闪验', value: "shanyan"},
            }
        },
        request: {
            all: false,
        }
    },
    mutations: {
        SET_ALL(state, data) {
            state.all = data;
        },
        SET_REQUESTING(state, name) {
            state.request[name] = true;
        },
        SET_REQUESTED(state, name) {
            state.request[name] = false;
        },
    },
    actions: Object.assign(actions(url), {
        BatchUpdate({commit}, data) {
            return Vue.axios.put(`${url}/batch`, data);
        },
    }),
};
